package edu.pku.sei.transformation.editor.actions;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.ui.PlatformUI;

import edu.pku.sei.transformation.editor.model.execution.TransformationExecution;

public class ExecuteTransformationAction extends Action {
	private TransformationExecution execution;
	public ExecuteTransformationAction(TransformationExecution execution) {
		this.execution = execution;
		this.setText("execute transformation");
	}
	
	@Override
	public void run() {	
		if (execution.check()) {
			execution.execute();
		} else {
			MessageDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow()
					.getShell(), "Check Warning", "Current Execution can not pass consistency check");
		}
		
	}
}
